<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

//Route::get('/users', function (Request $request) {
//
//    return $request->user();
//});

Route::get('/users', function () {
    //
    echo 'ff';
})->middleware('auth:api');


//})->middleware('auth:api');

Route::get('/jsondata', function ( ) {

//    return ['name','age'];
//    return ['name'=>'fei','age'=>'27'];
    return response()->json(['name'=>'fei','age'=>'27'], '200', ['Access-Control-Allow-Origin' => '*']);

});



//Route::resource('/token','Api\TokenController');
Route::post('/v1/token','Api\TokenController@getToken');


//Route::group(['prefix'=>'v1'],function(){
Route::group(['prefix'=>'v1','middleware'=>['auth:api']],function(){
    Route::resource('/users','Api\UsersController');
    Route::resource('/menus','Api\MenusController');
});
//})->middleware('auth:api');
